home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / builderExamples / beep3 / BeeperUI.c++ < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  4.5 KB  |  140 lines

  1. /////////////////////////////////////////////////////////////
  2. //
  3. // Source file for BeeperUI
  4. //
  5. //    This file generated by a BuilderXcessory.  DO NOT EDIT THIS FILE.
  6. //    TO ADD EXTENSIONS TO THIS CLASS, USE THE BUILDER XCESSORY
  7. //    TO CREATE A SUBCLASS.
  8. //
  9. //    This class is a user interface "component", as described
  10. //    in "Object-Oriented Programming with C++ and OSF/Motif",
  11. //    by Douglas Young, Prentice Hall, 1992. ISBN 0-13-630252-1
  12. //
  13. //
  14. /////////////////////////////////////////////////////////////
  15.  
  16.  
  17. #include "BeeperUI.h" // Generated header file for this class
  18. #include <Xm/Form.h> 
  19. #include <Xm/Label.h> 
  20. #include <Xm/PushB.h> 
  21. #ifndef XmNrow    
  22. #define XmNrow "row"
  23. #endif    
  24. #ifndef XmNcolumn    
  25. #define XmNcolumn "column"
  26. #endif     
  27.  
  28.  
  29.  
  30.  
  31.  
  32. // These are default resources for widgets in objects of this class
  33. // All resources will be prepended by *<name> at instantiation,
  34. // where <name> is the name of the specific instance, as well as the
  35. // name of the baseWidget. These are only defaults, and may be overriden
  36. // in a resource file by providing a more specific resource name
  37.  
  38. String  BeeperUI::_defaultBeeperUIResources[] = {
  39.         NULL
  40. };
  41.  
  42. BeeperUI::BeeperUI(const char *name, Widget parent) : 
  43.          VkComponent(name) 
  44.     Arg      args[10];
  45.     Cardinal count;
  46.  
  47.     count = 0;
  48.  
  49.     // Load any class-defaulted resources for this object
  50.  
  51.     setDefaultResources(parent, _defaultBeeperUIResources  );
  52.  
  53.  
  54.  
  55.     // Create an unmanaged widget as the top of the widget hierarchy
  56.  
  57.     _baseWidget = _beeper= XtVaCreateWidget ( _name,
  58.                                         xmFormWidgetClass,
  59.                                         parent, 
  60.                                             XmNresizePolicy, XmRESIZE_GROW, 
  61.                                         NULL); 
  62.  
  63.     // install a callback to guard against unexpected widget destruction
  64.  
  65.     installDestroyHandler();
  66.  
  67.  
  68.     // Create widgets used in this component
  69.     // All variables are data members of this class
  70.  
  71.     _pushButton = XtVaCreateManagedWidget  ( "pushButton",
  72.                                             xmPushButtonWidgetClass,
  73.                                             _w, 
  74.                                             XmNborderWidth, 0, 
  75.                                             XmNtopAttachment, XmATTACH_WIDGET, 
  76.                                             XmNbottomAttachment, XmATTACH_FORM, 
  77.                                             XmNleftAttachment, XmATTACH_FORM, 
  78.                                             XmNrightAttachment, XmATTACH_FORM, 
  79.                                             XmNtopOffset, 10, 
  80.                                             XmNbottomOffset, 60, 
  81.                                             XmNleftOffset, 50, 
  82.                                             XmNrightOffset, 50, 
  83.                                             NULL); 
  84.  
  85.     XtAddCallback ( _pushButton,
  86.                     XmNactivateCallback,
  87.                     &BeeperUI::beepCallback,
  88.                     (XtPointer) this ); 
  89.  
  90.  
  91.     _label = XtVaCreateManagedWidget  ( "label",
  92.                                             xmLabelWidgetClass,
  93.                                             _w, 
  94.                                             XmNborderWidth, 0, 
  95.                                             XmNrecomputeSize, True, 
  96.                                             XmNtopAttachment, XmATTACH_FORM, 
  97.                                             XmNbottomAttachment, XmATTACH_NONE, 
  98.                                             XmNleftAttachment, XmATTACH_FORM, 
  99.                                             XmNrightAttachment, XmATTACH_FORM, 
  100.                                             XmNtopOffset, 20, 
  101.                                             XmNbottomOffset, 0, 
  102.                                             XmNleftOffset, 61, 
  103.                                             XmNrightOffset, 62, 
  104.                                             NULL); 
  105.  
  106.  
  107.     XtVaSetValues ( _pushButton, 
  108.                                             XmNtopWidget, _label, 
  109.                     NULL);
  110. }
  111.  
  112. BeeperUI::~BeeperUI() 
  113. {
  114.     // Empty Destructor. Base class destroys widgets
  115. }
  116.  
  117. const char * BeeperUI::className() // classname
  118. {
  119.     return ("BeeperUI");
  120. }
  121.  
  122. void BeeperUI::beepCallback (Widget w, XtPointer clientData, XtPointer callData) 
  123.     BeeperUI* obj = (BeeperUI *) clientData;
  124.  
  125.     obj->beep(w, callData);
  126. }
  127.  
  128.  
  129.  
  130. void BeeperUI::beep(Widget, XtPointer) 
  131. {
  132.     // Empty virtual function. Called from beepCallback.
  133.     // Derived classes can override.
  134. }
  135.  
  136.  
  137.  
  138.